//
//  File:   AboutBox.java
//
package gui;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class AboutBox extends JFrame implements ActionListener {
    protected JLabel titleLabel, aboutLabel[];
    protected static int labelCount = 6;
    protected static int aboutWidth = 280;
    protected static int aboutHeight = 230;
    protected static int aboutTop = 200;
    protected static int aboutLeft = 350;
    protected Font titleFont, bodyFont;

    public AboutBox() {
        super();
        this.setResizable(false);
        SymWindow aSymWindow = new SymWindow();
        this.addWindowListener(aSymWindow);

        // Initialize useful fonts
        titleFont = new Font("Lucida Grande", Font.BOLD, 14);
        if (titleFont == null)
            titleFont = new Font("SansSerif", Font.BOLD, 14);

        bodyFont = new Font("Lucida Grande", Font.PLAIN, 12);
        if (bodyFont == null)
            bodyFont = new Font("SansSerif", Font.PLAIN, 12);


        this.getContentPane().setLayout(new BorderLayout(15, 15));

        aboutLabel = new JLabel[labelCount];
        aboutLabel[0] = new JLabel("");
        aboutLabel[1] = new JLabel("About FreeConf");
        aboutLabel[1].setFont(titleFont);
        aboutLabel[2] = new JLabel("Version 1.0");
        aboutLabel[2].setFont(bodyFont);
        aboutLabel[3] = new JLabel("");
        aboutLabel[4] = new JLabel("Copyright 2010");
        aboutLabel[4].setFont(bodyFont);
        aboutLabel[5] = new JLabel("");

        Panel textPanel2 = new Panel(new GridLayout(labelCount, 1));
        for (int i = 0; i<labelCount; i++) {
            aboutLabel[i].setHorizontalAlignment(JLabel.CENTER);
            textPanel2.add(aboutLabel[i]);
        }
        this.getContentPane().add(textPanel2, BorderLayout.CENTER);
        this.pack();
        this.setLocation(aboutLeft, aboutTop);
        this.setSize(aboutWidth, aboutHeight);
    }

    class SymWindow extends java.awt.event.WindowAdapter {
        public void windowClosing(java.awt.event.WindowEvent event) {
            setVisible(false);
        }
    }

    public void actionPerformed(ActionEvent newEvent) {
        setVisible(false);
    }
}
